<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
	<th:block th:include="include :: header('隐患详情')" />
	<link rel="stylesheet" href="/libs/mui/css/mui.min.css">
	<link rel="stylesheet" type="text/css" href="/libs/mui/css/app.css" />
	<link rel="stylesheet" type="text/css" href="/libs/mui/css/mui.picker.min.css" />
	<link rel="stylesheet" type="text/css" href="/common/css/public.css">
	<link rel="stylesheet" type="text/css" href="/common/css/style.css">
	<link rel="stylesheet" type="text/css" href="/common/css/form.css">
	<link  rel="stylesheet" type="text/css"  href="/libs/webuploader/webuploader.css"/>
</head>
<body>
<div class="up_list_content">
	<!--表单start-->
	<div class="up_content_form" th:if="${index == 0}">
		<!--<form class="up_group">
			<div class="up_row">
				<label><font>*</font>文本域</label>
				<textarea rows="5" placeholder="请输入" name="" required></textarea>
				<div class="clear_both"></div>
			</div>
			<div class="up_row">
				<label><font>*</font>人员选择</label>
				<input type="hidden" name="Status" th:value="2">
				<input type="hidden" name="ReviewUserID"/>
				<input type="text" onclick="selectUserTree(this)" name="ignore7" bind-name="ReviewUserID" placeholder="请选择"  required>
				<div class="clear_both"></div>
			</div>
			<div class="up_row record-select" th:data="${@dict.getTypeByJson('HIHiddenDangerTypes')}">
				<label><font>*</font>类型选择</label>
				<input type="text" class="record-select-data" name="ignore3" placeholder="请选择" required>
				<input type="hidden" class="record-select-id" name="HIHiddenDangerTypeID">
				<icon class="icon_more fright"></icon>
				<div class="clear_both"></div>
			</div>
			<div class="up_row">
				<label><font>*</font>责任单位</label>
				<input type="hidden" name="ResOrganizationID" />
				<input type="text" onclick="selectDeptTree(this)" name="ignore5" bind-name="ResOrganizationID" placeholder="请选择" required>
				<icon class="icon_more fright"></icon>
				<div class="clear_both"></div>
			</div>
			<div class="up_row">
				<label><font>*</font>整改期限</label>
				<input type="text" class="date-select" placeholder="请选择" name="DeadLine" required>
				<icon class="icon_more fright"></icon>
				<div class="clear_both"></div>
			</div>
			<div class="up_row">
				<label><font>*</font>回显内容</label>
				<input type="text" rows="5" placeholder="请输入" name="RectificationRequest" value="是的" required>
				<div class="clear_both"></div>
			</div>
			<div id="filePicker" class="up_file_img up_file_img_top" ></div>
			<div class="mui-input-row up_row up_file_list up_fileimg_list">
				<input type="hidden" id="imageIds" name="CreateAttachment"/>
				<label><font></font>隐患附件</label>
				<div class="clear_both"></div>
				<div class="up_fileimg_right" >
					<div id="preview"></div>
					<div class="clear_both"></div>
					<div></div>
				</div>
				<div class="clear_both"></div>
			</div>
			<div class="up_content_button">
				<input class="up_butt tg" type="button" value="通过" />
				<input class="up_butt bh" type="button" value="驳回" />
				<div class="clear_both"></div>
			</div>
			<div class="up_content_button">
				<input class="up_butt up_button_one_le tg" type="button" value="确认" />
				<div class="clear_both"></div>
			</div>
		</form>-->
		<!--审核中-->
		<form class="up_group" id="sh" th:if="${status == '1'}">
			<div class="up_row up_btextarea">
				<label><font>*</font>审核意见</label>
				<textarea rows="5" placeholder="请输入" name="FirstAppOpinion" required></textarea>
			</div>

			<input th:value="${details.ID}" type="hidden" class="id" name="ID">

			<div class="up_row">
				<label><font>*</font>复查人</label>
				<input type="hidden" name="Status" th:value="2">
				<input type="hidden" name="ReviewUserID"/>
				<input type="text"  onclick="selectUserTree(this)" name="ignore7" bind-name="ReviewUserID" placeholder="请选择" id="ReviewUserID"  required>
				<div class="clear_both"></div>
			</div>

			<div class="up_content_button" id="FirstAppResult-">
				<input class="up_butt tg" type="button" id="shtg" value="通过" />
				<input class="up_butt bh" type="button" id="shbh" value="驳回" />
				<div class="clear_both"></div>
			</div>
		</form>
		<!--待整改 和 复查未通过 整改操作-->
		<form class="up_group" id="zg" th:if="${(status == '2' || status == '6') && rectifyStatus == 0}">
			<div class="up_row up_btextarea">
				<label><font>*</font>整改措施</label>
				<textarea rows="5" placeholder="请输入" name="FixMeasures" required></textarea>
			</div>

			<input th:value="${details.ID}" type="hidden" class="id" name="ID">

			<div class="up_row">
				<label><font>*</font>整改时间</label>
				<input type="text" class="date-select " placeholder="请选择" name="FixDate" required>
				<icon class="icon_more fright"></icon>
				<div class="clear_both"></div>
			</div>

			<!--整改附件-->
			<div class="up_content_button">
				<input class="up_bubh tg" id="zgtg" type="button" value="提交" />
				<div class="clear_both"></div>
			</div>
		</form>
		<!--待整改 和 复查未通过 迁转操作-->
		<form class="up_group" id="qz" th:if="${(status == '2' || status == '6') && rectifyStatus == 1}">

			<input th:value="${details.ID}" type="hidden" class="id" name="ID">

			<div class="up_row up_qz">
				<label><font>*</font>签转后责任部门/车间</label>
				<input type="hidden" name="AfterResOrganizationID" />
				<input type="text"  onclick="selectDeptTree(this)" name="ignore5" bind-name="AfterResOrganizationID" placeholder="请选择" id="AfterResOrganizationID"  required>
				<icon class="icon_more fright"></icon>
				<div class="clear_both"></div>
			</div>
			<div class="up_row up_qz">
				<label><font>*</font>签转后负责人</label>
				<input type="hidden" name="Status" th:value="2">
				<input type="hidden" name="AfterResUserID"/>
				<input type="text"  onclick="selectUserTree(this)" name="ignore7" bind-name="AfterResUserID" placeholder="请选择" id="AfterResUserID"  required>
				<div class="clear_both"></div>
			</div>
			<div class="up_content_button">
				<input class="up_bubh tg" type="button" id="qztg" value="提交" />
				<!--<input class="up_butt bh" type="button" value="驳回" />-->
				<div class="clear_both"></div>
			</div>
		</form>
		<!--待整改 和 复查未通过 延期整改操作-->
		<form class="up_group" id="WantDelay" th:if="${(status == '2' || status == '6') && rectifyStatus == 2}">

			<input th:value="${details.ID}" type="hidden" class="id" name="ID">
			<div class="up_row up_btextarea">
				<label><font>*</font>延期原因</label>
				<textarea rows="5" placeholder="请输入" name="DelayReason" required></textarea>
			</div>

			<div class="up_row">
				<font>整改期限：</font>
				<span th:text="${details.DeadLine}">***</span>
				<div class="clear_both"></div>
			</div>

			<div class="up_row">
				<label><font>*</font>延期至</label>
				<input type="text" class="date-select " placeholder="请选择" name="WantDeadLine" required>
				<icon class="icon_more fright"></icon>
				<div class="clear_both"></div>
			</div>

			<div class="up_row">
				<label><font>*</font>延期审核人</label>
				<input type="hidden" name="Status" th:value="2">
				<input type="hidden" name="DelayAppUserID"/>
				<input type="text"  onclick="selectUserTree(this)" name="ignore7" bind-name="DelayAppUserID" placeholder="请选择" id="DelayAppUserID"  required>
				<div class="clear_both"></div>
			</div>

			<!--防范措施（附件）-->
			<div class="up_content_button">
				<input class="up_bubh tg" type="button" id="Delaytg" value="提交" />
				<div class="clear_both"></div>
			</div>
		</form>
		<!--待复查 -->
		<form class="up_group" th:if="${status == '3'}" id="fc">

			<div class="up_row">
				<label><font>*</font>复查意见</label>
				<textarea rows="5" placeholder="请输入" name="ReviewOpinion" required></textarea>
			</div>

			<input th:value="${details.ID}" type="hidden" class="id" name="ID">

			<div class="up_content_button">
				<input class="up_butt tg" type="button" value="通过" id="fctj" />
				<input class="up_butt bh" type="button" value="驳回" id="fcbh"/>
				<div class="clear_both"></div>
			</div>
		</form>
		<!--延期待审批-->
		<form class="up_group" th:if="${status == '4'}" id="yq">

			<div class="up_row">
				<font>延期原因：</font>
				<span th:text="${details.DelayReason}">***</span>
				<div class="clear_both"></div>
			</div>

			<div class="up_row">
				<font>整改期限：</font>
				<span th:text="${details.DeadLine}">***</span>
				<div class="clear_both"></div>
			</div>

			<div class="up_row">
				<font>延期至：</font>
				<input th:value="${details.WantDeadLine}" type="hidden" id="WantDeadLine" >
				<span id="Want1" th:text="${details.WantDeadLine}" >***</span>
				<div class="clear_both"></div>
			</div>


			<div class="up_row">
				<label><font>*</font>延期审核意见</label>
				<textarea rows="5" placeholder="请输入" name="OrgDelayAppOpinion" required></textarea>
			</div>
			<input th:value="${details.ID}" type="hidden" class="id" name="ID">

			<div class="up_content_button">
				<input class="up_butt tg" type="button" value="通过" id="yqtg" />
				<input class="up_butt bh" type="button" value="驳回" id="yqbh" />
				<div class="clear_both"></div>
			</div>
		</form>
	</div>
	<!--表单end-->
	<!--详情内容start-->
	<div class="up_content_desc">
		<ul class="list_nav list_nav_block">
			<li>
				<div class="list_nav_top">
					<span class="list_nav_zt list_nav_zt_one fleft" th:if="${details.Status == 0}">未提交</span>
					<span class="list_nav_zt list_nav_zt_two fleft" th:if="${details.Status == 1}">审核中</span>
					<span class="list_nav_zt list_nav_zt_three fleft" th:if="${details.Status == 2}">待整改</span>
					<span class="list_nav_zt list_nav_zt_four fleft" th:if="${details.Status == 3}">待复查</span>
					<span class="list_nav_zt list_nav_zt_five fleft" th:if="${details.Status == 4}">延期待审批</span>
					<span class="list_nav_zt list_nav_zt_six fleft" th:if="${details.Status == 5}">审核未通过</span>
					<span class="list_nav_zt list_nav_zt_seven fleft" th:if="${details.Status == 6}">复查未通过</span>
					<span class="list_nav_zt list_nav_zt_eight fleft" th:if="${details.Status == 7}">已闭环</span>
					<span class="list_nav_time fright" th:text="'检查时间： '+${details.FindDate}">检查时间：2019-09-08</span>
					<div class="clear_both"></div>
				</div>
				<div class="list_nav_desc">
					<input th:value="${details.ID}" type="hidden" class="id">
					<font>检查单位：</font>
					<span th:text="${details.DiscoverUserNames}">***</span>
					<div class="clear_both"></div>

					<font>检查人：</font>
					<span th:text="${details.DiscoverUserNames}">***</span>
					<div class="clear_both"></div>

					<font>隐患地点：</font>
					<span th:text="${details.HDPlace}">***</span>
					<div class="clear_both"></div>

					<font>隐患内容：</font>
					<span th:text="${details.HDName}">***</span>
					<div class="clear_both"></div>

					<font>责任部门：</font>
					<span th:text="${details.ResOrganizationName}">***</span>
					<div class="clear_both"></div>

					<font>隐患类型：</font>
					<span th:text="${details.HIHiddenDangerTypeName}">***</span>
					<div class="clear_both"></div>

					<font>隐患等级：</font>
					<span th:text="${details.HIHiddenDangerLevelName}">***</span>
					<div class="clear_both"></div>

					<font>整改要求：</font>
					<span th:text="${details.RectificationRequest}">***</span>
					<div class="clear_both"></div>

					<font>整改责任人：</font>
					<span th:text="${details.ResUserName}">***</span>
					<div class="clear_both"></div>

					<font>整改期限：</font>
					<span th:text="${details.DeadLine}">***</span>
					<div class="clear_both"></div>

					<font>创建时间：</font>
					<span th:text="${details.CreateDate}">***</span>
					<div class="clear_both"></div>

					<font>隐患附件：</font>
					<span>
						<a th:each="attachment,index : ${details.CreateAttachment}" th:href="${attachment.Path}">
							<img  th:src="${attachment.Path}">
						</a>

					</span>
					<div class="clear_both"></div>
				</div>
			</li>
		</ul>
	</div>
	<!--详情内容end-->
	<!--流程start-->
	<div class="up_content_lcheng">
		<ul>
			<li th:each="log,index : ${logs}">
				<div class="fleft">
					<span class="list_nav_zt list_nav_zt_four" th:text="${log.name}">待复查</span>
					<!--<div class="up_lcheng_bg"><img src="images/dian.png" width="14" height="14"></div>-->
				</div>
				<div class="up_cont_lcright fright">
					<span class="fleft" th:text="${log.operateName}">姜俊雄</span>
					<font class="fright up_cont_time" th:text="${log.createdate}">12.16 09:00</font>
					<div class="clear_both"></div>
					<p th:text="${log.content}">隐患内容</p>
				</div>
				<div class="clear_both"></div>
			</li>
		</ul>
	</div>
	<!--流程end-->
</div>
</body>
<th:block th:include="include :: footer" />
<script src="/libs/mui/js/mui.min.js"></script>
<script src="/libs/mui/js/mui.picker.min.js"></script>
<script src="/libs/webuploader/webuploader.nolog.js"></script>
<script src="/common/js/form.js"></script>
<script>
    // 初始化Web Uploader
    var uploader = WebUploader.create({
        // 选完文件后，是否自动上传。
        auto: true,

        // 文件接收服务端。
        server: ctx + '/public/UpoladFiles',

        // 选择文件的按钮。可选。
        // 内部根据当前运行是创建，可能是input元素，也可能是flash.
        pick: '#filePicker',

        // 只允许选择图片文件。
        accept: {
            title: 'Images',
            extensions: 'gif,jpg,jpeg,bmp,png',
            mimeTypes: 'image/*'
        }
    });


    //初始化图片上传 事件
    uploaderInit(uploader);
    //删除图片
    $(document).on("click",".file_close",function(){
        var fileDiv = $(this).parent();
        var fileId = fileDiv.attr("id");
        var imageIds = $("#imageIds").val();
        $("#imageIds").val(imagesIdsReplace(imageIds,fileDiv));
        fileDiv.remove();
        uploader.removeFile(fileId);
    });



    //通过审核
    $("#shtg").click(function(){
        if($("#news").val()==null){
            $("#sh").append('<input type="hidden" name="FirstAppResult" id="news" value="true"/><br/><br/>');
		};
        if($("#news").val()=="false"){
            $("#news").val("true");
        };

        console.log($.common.serializeNotNull()+"&entityName=HIHiddenDanger&opName=FirstApprove&userId="+$.userOperate.userId());
        var data = $("#sh").serialize()+"&entityName=HIHiddenDanger&opName=FirstApprove&userId="+$.userOperate.userId();
        console.log(data);
        if($.validate.form()){
            $.ajax({
                url:ctx+"/public/Save",
                type:"post",
                data:data,
                dataType:"json",
                success:function (obj) {

                    if(obj.statusCode==0){
                        location.href = "/hidden/list?userId="+$.userOperate.userId();
                    }else{
                        alert(obj.statusMsg);
                    }
                }
            })
        }
    });
    //驳回审核
    $("#shbh").click(function(){
        if($("#news").val()==null){
            $("#sh").append('<input type="hidden" name="FirstAppResult" id="news" value="false"/><br/><br/>');
        };
        if($("#news").val()=="true"){
            $("#news").val("false");
        };

        console.log($.common.serializeNotNull()+"&entityName=HIHiddenDanger&opName=FirstApprove&userId="+$.userOperate.userId());
        var data = $("#sh").serialize()+"&entityName=HIHiddenDanger&opName=FirstApprove&userId="+$.userOperate.userId();
        console.log(data);
        if($.validate.form()){
            $.ajax({
                url:ctx+"/public/Save",
                type:"post",
                data:data,
                dataType:"json",
                success:function (obj) {

                    if(obj.statusCode==0){
                        location.href = "/hidden/home?openId="+$.userOperate.openId();
                    }else{
                        alert(obj.statusMsg);
                    }
                }
            })
        }
    });


    //通过延期
    $("#yqtg").click(function(){
        if($("#news").val()==null){
            $("#yq").append('<input type="hidden" name="OrgDelayAppResult" id="news" value="true"/><br/><br/>');
        };
        if($("#news").val()=="false"){
            $("#news").val("true");
        };


        console.log($.common.serializeNotNull()+"&entityName=HIHiddenDanger&opName=DelayApp&userId="+$.userOperate.userId());
        var data = $("#yq").serialize()+"&entityName=HIHiddenDanger&opName=DelayApp&userId="+$.userOperate.userId();
        console.log(data);
        if($.validate.form()){
            $.ajax({
                url:ctx+"/public/Save",
                type:"post",
                data:data,
                dataType:"json",
                success:function (obj) {

                    if(obj.statusCode==0){
                        location.href = "/hidden/list?userId="+$.userOperate.userId();
                    }else{
                        alert(obj.statusMsg);
                    }
                }
            })
        }
    }); //驳回延期审核
    $("#yqbh").click(function(){
        if($("#news").val()==null){
            $("#yq").append('<input type="hidden" name="OrgDelayAppResult" id="news" value="false"/><br/><br/>');
        }
        if($("#news").val()=="true"){
            $("#news").val("false");
        }

        console.log($.common.serializeNotNull()+"&entityName=HIHiddenDanger&opName=DelayApp&userId="+$.userOperate.userId());
        var data = $("#yq").serialize()+"&entityName=HIHiddenDanger&opName=DelayApp&userId="+$.userOperate.userId();
        console.log(data);
        if($.validate.form()){
            $.ajax({
                url:ctx+"/public/Save",
                type:"post",
                data:data,
                dataType:"json",
                success:function (obj) {

                    if(obj.statusCode==0){
                        location.href = "/hidden/list?userId="+$.userOperate.userId();
                    }else{
                        alert(obj.statusMsg);
                    }
                }
            })
        }
    });
    //提交整改
    $("#zgtg").click(function(){
        console.log($.common.serializeNotNull()+"&entityName=HIHiddenDanger&opName=Fix&userId="+$.userOperate.userId());
        var data = $("#zg").serialize()+"&entityName=HIHiddenDanger&opName=Fix&userId="+$.userOperate.userId();
        console.log(data);
		if($.validate.form()){
		 $.ajax({
		 url:ctx+"/public/Save",
		 type:"post",
		 data:data,
		 dataType:"json",
		 success:function (obj) {

		 if(obj.statusCode==0){
		 location.href = "/hidden/list?userId="+$.userOperate.userId();
		 }else{
		 alert(obj.statusMsg);
		 }
		 }
		 })
		 }
    });
    //提交复查
    $("#fctj").click(function(){
        if($("#news").val()==null){
            $("#fc").append('<input type="hidden" name="ReviewResult" id="news" value="true "/><br/><br/>');
        };
        if($("#news").val()=="false"){
            $("#news").val("true");
        };

        console.log($.common.serializeNotNull()+"&entityName=HIHiddenDanger&opName=Review&userId="+$.userOperate.userId());
        var data = $("#fc").serialize()+"&entityName=HIHiddenDanger&opName=Review&userId="+$.userOperate.userId();
        console.log(data);
        if($.validate.form()){
            $.ajax({
                url:ctx+"/public/Save",
                type:"post",
                data:data,
                dataType:"json",
                success:function (obj) {

                    if(obj.statusCode==0){
                        location.href = "/hidden/list?userId="+$.userOperate.userId();
                    }else{
                        alert(obj.statusMsg);
                    }
                }
            })
        }
    });
    //驳回复查
    $("#fcbh").click(function(){
        if($("#news").val()==null){
            $("#fc").append('<input type="hidden" name="ReviewResult" id="news" value="false"/><br/><br/>');
        }
        if($("#news").val()=="true"){
            $("#news").val("false");
        }


        console.log($.common.serializeNotNull()+"&entityName=HIHiddenDanger&opName=Review&userId="+$.userOperate.userId());
        var data = $("#fc").serialize()+"&entityName=HIHiddenDanger&opName=Review&userId="+$.userOperate.userId();
        console.log(data);
        if($.validate.form()){
            $.ajax({
                url:ctx+"/public/Save",
                type:"post",
                data:data,
                dataType:"json",
                success:function (obj) {

                    if(obj.statusCode==0){
                        location.href = "/hidden/list?userId="+$.userOperate.userId();
                    }else{
                        alert(obj.statusMsg);
                    }
                }
            })
        }
    });

    //提交签转
    $("#qztg").click(function(){
        console.log($.common.serializeNotNull()+"&entityName=HIHiddenDanger&opName=Sign&userId="+$.userOperate.userId());
        var data = $("#qz").serialize()+"&entityName=HIHiddenDanger&opName=Sign&userId="+$.userOperate.userId();
        console.log(data);
        if($.validate.form()){
            $.ajax({
                url:ctx+"/public/Save",
                type:"post",
                data:data,
                dataType:"json",
                success:function (obj) {

                    if(obj.statusCode==0){
                        location.href = "/hidden/list?userId="+$.userOperate.userId();
                    }else{
                        alert(obj.statusMsg);
                    }
                }
            })
        }
    });

    //提交延期
    $("#Delaytg").click(function(){
        console.log($.common.serializeNotNull()+"&entityName=HIHiddenDanger&opName=WantDelay&userId="+$.userOperate.userId());
        var data = $("#WantDelay").serialize()+"&entityName=HIHiddenDanger&opName=WantDelay&userId="+$.userOperate.userId();
        console.log(data);
        if($.validate.form()){
            $.ajax({
                url:ctx+"/public/Save",
                type:"post",
                data:data,
                dataType:"json",
                success:function (obj) {

                    if(obj.statusCode==0){
                        location.href = "/hidden/list?userId="+$.userOperate.userId();
                    }else{
                        alert(obj.statusMsg);
                    }
                }
            })
        }
    });

//    //延期时间转换
//    var date=$("#WantDeadLine").val();
//
//    $(function(){
//       if($("#WantDeadLine").val()!=null){
//
//           function getFDate(date) {
//               var d = eval('new ' + date.substr(1, date.length - 2));
//
//               var ar_date = [d.getFullYear(), d.getMonth() + 1, d.getDate()];
//
//               for (var i = 0; i < ar_date.length; i++) ar_date[i] = dFormat(ar_date[i]);
//               return ar_date.join('-');
//           }
//           function dFormat(i) {
//               return i < 10 ? "0" + i.toString() : i;
//           };
//
//           var aa=getFDate(date);
//           //	$("#Want").val(aa);
//           $("#Want1").val(aa);
//           document.getElementById("Want1").innerText =aa;
//
//	   }
//        });

</script>
</html>
